<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!DOCTYPE html>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="s" %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>Shamcey - Metro Style Admin Template</title>

    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.default.css" type="text/css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap-fileupload.min.css" type="text/css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap-timepicker.min.css" type="text/css"/>

    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-migrate-1.1.1.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-ui-1.9.2.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap-fileupload.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap-timepicker.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.uniform.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.validate.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.tagsinput.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.autogrow-textarea.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/charCount.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/colorpicker.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/ui.spinner.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/chosen.jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.cookie.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/modernizr.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/custom.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/forms.js"></script>
    <script type="text/javascript">
        jQuery(document).ready(function () {
            // dynamic table
            jQuery('#dyntable').dataTable({
                "sPaginationType": "full_numbers",
                "aaSortingFixed": [[0, 'asc']],
                "fnDrawCallback": function (oSettings) {
                    jQuery.uniform.update();
                }
            });

            jQuery('#dyntable2').dataTable({
                "bScrollInfinite": true,
                "bScrollCollapse": true,
                "sScrollY": "300px"
            });

        });
        function  togo(){

            var ym=document.getElementById("pageCode").value;

            if(!/^[1-9]\d*$/.test(ym)) {//对当前页码进行整数校验
                alert('请输入正确的页码！');
                return;
            }
            if(ym > ${pagemsg.totalPage}) {//判断当前页码是否大于最大页
                alert('请输入正确的页码！');
                return;
            }
            window.location= "${pageContext.request.contextPath }/studentQuery?currentPage="+ym;
        }
    </script>
</head>
<title>老师登陆成功</title>
<body>

<div class="mainwrapper">

    <div class="header">
        <div class="logo">
            <a href="teacher"><img src="${pageContext.request.contextPath}/images/logo.png" alt=""/></a>
        </div>
        <div class="headerinner">
            <ul class="headmenu">

                <li class="right">
                    <div class="userloggedinfo">
                        <img src="${pageContext.request.contextPath}/images/photos/thumb1.png" alt=""/>
                        <div class="userinfo">
                            <h5>${sessionScope.teacherinfo.teacherID} <small>you are welcome</small></h5>
                            <ul>
                                <li><a href="examlogin">退出登录</a></li>
                            </ul>
                        </div>
                    </div>
                </li>
            </ul><!--headmenu-->
        </div>
    </div>

    <div class="leftpanel" style="margin-left: 0px;">

        <div class="leftmenu">
            <ul class="nav nav-tabs nav-stacked">
                <li class="nav-header">Navigation</li>

                <li class="dropdown"><a href=""><span class="iconfa-pencil"></span> 学生管理</a>
                    <ul>
                        <li class=""><a  href="studentadd">添加学生</a></li>
                        <li><a href="studentQuery">查询所有学生</a></li>
                    </ul>
                </li>
                <li class="dropdown active"><a href=""><span class="iconfa-briefcase"></span> 试题管理</a>
                    <ul>
                        <li class="dropdown"><a href=""><span class="iconfa-briefcase"></span>添加试题</a>
                            <ul>
                                <li><a href="xuanzesubjectadd">选择题</a></li>
                                <li><a href="tiankongsubjectadd">填空题</a></li>
                                <li><a href="panduansubjectadd">判断题</a></li>
                                <li><a href="wendasubjectadd">问答题</a></li>
                            </ul>
                        </li>

                        <li class="dropdown"><a href=""><span class="iconfa-briefcase"></span>查询所有试题</a>
                            <ul>
                                <li><a href="selectxuanze">选择题</a></li>
                                <li><a href="selecttiankong">填空题</a></li>
                                <li><a href="selectpanduan">判断题</a></li>
                                <li><a href="selectwenda">问答题</a></li>
                            </ul>
                        </li>
                        <li><a href="selectsubject">搜索试题</a></li>
                    </ul>
                </li>

            </ul>
        </div><!--leftmenu-->

    </div><!-- leftpanel -->

    <div class="rightpanel">

        <ul class="breadcrumbs">
            <li><a href="teacher"><i class="iconfa-home"></i></a> <span class="separator"></span></li>
            <li><a href="studentQuery">学生管理</a> <span class="separator"></span></li>
            <li>查询所有学生</li>

            <li class="right">
                <a href="" data-toggle="dropdown" class="dropdown-toggle"><i class="icon-tint"></i> Color Skins</a>
                <ul class="dropdown-menu pull-right skin-color">
                    <li><a href="default">Default</a></li>
                    <li><a href="navyblue">Navy Blue</a></li>
                    <li><a href="palegreen">Pale Green</a></li>
                    <li><a href="red">Red</a></li>
                    <li><a href="green">Green</a></li>
                    <li><a href="brown">Brown</a></li>
                </ul>
            </li>
        </ul>

        <div class="pageheader">
            <a href="sclass">
                <button>根据班级查找学生</button>
            </a>
            <a href="name">
                <button>根据姓名查找学生</button>
            </a>
            <a href="studentid">
                <button>根据学号查找学生</button>
            </a>
        </div>
        <div class="maincontent">
            <div class="maincontentinner">

                <h4 class="widgettitle">学生表</h4>
                <table id="dyntable" class="table table-bordered responsive">
                    <colgroup>
                        <col class="con0" style="align: center; width: 15%"/>

                        <col class="con0" style="align: center; width: 15%"/>
                        <col class="con1" style="align: center; width: 15%"/>
                        <col class="con0" style="align: center; width: 15%"/>
                        <col class="con1"/>
                    </colgroup>
                    <thead>
                    <tr>

                        <th class="head0">学生编号</th>
                        <th class="head1">所属班级</th>
                        <th class="head0">学生姓名</th>
                        <th class="head1">成绩</th>
                    </tr>
                    </thead>
                    <tbody>

                    <s:forEach items="${requestScope.pagemsg.lists}" var="u">
                        <tr align="center">
                            <td>${u.studentID}</td>
                            <td>${u.sclass}</td>
                            <td>${u.studentName}</td>
                            <td>${u.result}</td>
                        </tr>
                    </s:forEach>
                 <tr>
                        <td colspan="6" align="center">
                            <span>第${requestScope.pagemsg.currPage }/ ${requestScope.pagemsg.totalPage}页</span>  
                            <span>总记录数：${requestScope.pagemsg.totalCount }  每页显示:${requestScope.pagemsg.pageSize}</span>  
                            <span>
       <s:if test="${requestScope.pagemsg.currPage != 1}">
           <a href="${pageContext.request.contextPath }/studentQuery?currentPage=1">[首页]</a>  
           <a href="${pageContext.request.contextPath }/studentQuery?currentPage=${requestScope.pagemsg.currPage-1}">[上一页]</a>  
       </s:if>
       <s:choose>
       <s:when test="${pagemsg.totalPage <=6}">
                      <c:set var="begin" value="1"/>
                      <c:set var="end" value="${pagemsg.totalPage}"/>
       </s:when>
       <s:otherwise>
           <s:set var="begin" value="${pagemsg.currPage-2}"/>
           <s:set var="end" value="${pagemsg.currPage+3}"/>
           <s:if test="${begin<1}">
               <c:set var="begin" value="1"/>
               <c:set var="end" value="6"/>
           </s:if>
           <s:if test="${end>pagemsg.totalPage}">
               <c:set var="begin" value="${pagemsg.totalPage-5}"/>
               <c:set var="end" value="${pagemsg.totalPage}"/>
           </s:if>
       </s:otherwise>
       </s:choose>
       <s:forEach begin="${begin}" end="${end}" var="i">
           <s:choose>
               <s:when test="${i eq pagemsg.currPage}">
               <span class="spanBtnSelect">${i}</span>
               </s:when>
           </s:choose>
       </s:forEach>
       <s:if test="${end < pagemsg.totalPage }">
               <span class="spanApostrophe">...</span>
       </s:if>

        <s:if test="${requestScope.pagemsg.currPage != requestScope.pagemsg.totalPage}">
           <a href="${pageContext.request.contextPath }/studentQuery?currentPage=${requestScope.pagemsg.currPage+1}">[下一页]</a>  
           <a href="${pageContext.request.contextPath }/studentQuery?currentPage=${requestScope.pagemsg.totalPage}">[尾页]</a>  
       </s:if>


            <span>到</span>
            <input type="text" class="inputPageCode" id="pageCode" value="${pagemsg.currPage}"/>
            <span>页</span>
             <input type="button" value="确定" onclick="togo()">
                        </td>
                    </tr>

                    </tbody>
                </table>

                <br/><br/>

                <div class="footer">
                    <div class="footer-left">
                        <span></span>
                    </div>

                </div><!--footer-->

            </div><!--maincontentinner-->
        </div><!--maincontent-->


    </div><!--rightpanel-->

</div><!--mainwrapper-->

</body>
</html>